/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.cash.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.employee.entity.Employee;

/**
 * 新开卡业务消费Entity
 * @author liujiang
 * @version 2013-11-24
 */
@Entity
@Table(name = "store_consume_new_card")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreConsumeNewCard extends BaseEntity {
	public static final int CARD_TYPE_TIMES = 0;//计次护理卡
	public static final int CARD_TYPE_DURATION = 1;//时段护理卡
	public static final int CARD_TYPE_PRODUCT = 2;//产品充值卡
	public static final int CARD_TYPE_ALL = 3;//综合充值卡
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private int card_type; 	// 会员卡类型0  -  计次护理卡1  -  时段护理卡2  -  产品充值卡3  -  综合充值卡
	private long card_id;	//新开会员卡编号（同时支持所有不同类型的会员卡）
	private StoreConsume storeConsume; //消费编号
	private Employee employee;		//会员卡充值员工编号
	private float real_cost;	//实际成交价
	private float bonus;	// 员工业务提成
	private String remark;	//备注

	public StoreConsumeNewCard() {
	}

	public StoreConsumeNewCard(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public int getCard_type() {
		return card_type;
	}

	public void setCard_type(int card_type) {
		this.card_type = card_type;
	}

	public long getCard_id() {
		return card_id;
	}

	public void setCard_id(long card_id) {
		this.card_id = card_id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="CONSUME_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public StoreConsume getStoreConsume() {
		return storeConsume;
	}

	public void setStoreConsume(StoreConsume storeConsume) {
		this.storeConsume = storeConsume;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="EMPLOYEE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
	public float getReal_cost() {
		return real_cost;
	}

	public void setReal_cost(float real_cost) {
		this.real_cost = real_cost;
	}

	public float getBonus() {
		return bonus;
	}

	public void setBonus(float bonus) {
		this.bonus = bonus;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}

